package com.xiaoke.mapper;

import com.xiaoke.entity.Cart;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

@Mapper
public interface CartMapper {
    int deleteByPrimaryKey(String id);

    int insert(Cart record);

    int insertSelective(Cart record);

    Cart selectByPrimaryKey(String id);

    int updateByPrimaryKeySelective(Cart record);

    int updateByPrimaryKey(Cart record);

    List<Map<String,Object>> findByUserAndShop(@Param("userId") String userId,@Param("shopId") String shopId);

    Cart findByParams(Map<String, Object> params);

    void deleteByIds(String[] id);

    BigDecimal sumByChecked(@Param("userId") String userId,@Param("shopId") String shopId);

    List<Map<String,Object>> findByChecked(@Param("userId") String userId,@Param("shopId") String shopId);

    Map<String,Object> sumTotalPriceByChecked(@Param("userId") String userId,@Param("shopId") String shopId);

    Integer countByUserAndShopAndUnChecked(@Param("userId") String userId,@Param("shopId") String shopId);
}